package com.example.dtest.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @date 2021/5/8 17:13
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {

    private String status;

    private Object data;

    private String msg;

    public static Result success() {
        return new Result("success", null, "操作成功");
    }

    public static Result success(Object data) {
        return new Result("success", data, "操作成功");
    }

    public static Result success(String msg) {
        return new Result("success", null, msg);
    }

    public static Result success(Object data, String msg) {
        return new Result("success", data, msg);
    }

    public static Result fail() {
        return new Result("fail", null, "操作失败");
    }

    public static Result fail(String msg) {
        return new Result("fail", null, msg);
    }

    public static Result fail(String status, String msg) {
        return new Result(status, null, msg);
    }
}
